package com.pattern.adapter;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.Stack;
import java.util.Vector;

import org.junit.Test;

public class EcumerationTest {
	@Test
	public void testEnumeration() {
		Vector<Integer> vector = new Vector<Integer>();

		vector.add(1);
		vector.add(2);
		vector.add(3);

		int sum = 0;
		Enumeration<Integer> intE = vector.elements();
		while (intE.hasMoreElements()) {
			sum += intE.nextElement();
		}

		sum = 0;
		Iterator<Integer> it = vector.iterator();
		while(it.hasNext()) {
			sum += it.next();
		}
		
		assertThat(sum, is(6));
	}
}
